class UserSession {
  final String gsid;
  final String accessToken;
  final String refreshToken;
  final DateTime expireAt;

  const UserSession({
    required this.gsid,
    required this.accessToken,
    required this.refreshToken,
    required this.expireAt,
  });

  Map<String, dynamic> toJson() => {
        'gsid': gsid,
        'accessToken': accessToken,
        'refreshToken': refreshToken,
        'expireAt': expireAt.toIso8601String(),
      };

  factory UserSession.fromJson(Map<String, dynamic> json) => UserSession(
        gsid: json['gsid'],
        accessToken: json['accessToken'],
        refreshToken: json['refreshToken'],
        expireAt: DateTime.parse(json['expireAt']),
      );
}

class RememberMe {
  final String username;

  // 这里存储的是加密后的密码
  final String password;

  const RememberMe({
    required this.username,
    required this.password,
  });

  Map<String, dynamic> toJson() => {
        'username': username,
        'password': password,
      };

  static RememberMe fromJson(Map<String, dynamic> json) => RememberMe(
        username: json['username'],
        password: json['password'],
      );
}
